package com.tar.system.sys.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.tar.commons.web.controller.BaseController;
import com.tar.commons.web.utils.UploaderUtil;
import com.tar.commons.web.utils.UploaderVo;
import com.tar.system.sys.web.form.DemoForm;

@Controller
@RequestMapping("/demo")
public class DemoController extends BaseController {
	
	@RequestMapping(value={"", "/{main:main?.*}"}, method=RequestMethod.GET)
	public String main() {
		return "demo/main" ;
	}
	
	@RequestMapping(value="/i18n", method=RequestMethod.GET)
	public String i18n() {
		return "demo/i18n" ;
	}

	@RequestMapping(value="/ueditor", method=RequestMethod.GET)
	public String ueditor() {
		return "demo/ueditor" ;
	}
	
	@RequestMapping(value="/upload_main", method=RequestMethod.GET)
	public String upload_main() {
		return "demo/upload_main" ;
	}
	
	@RequestMapping(value="uploader", method=RequestMethod.POST)
	@ResponseBody
	public UploaderVo uploader(MultipartHttpServletRequest multipartRequest) {
		return UploaderUtil.upload(multipartRequest, "/abc");
	}
	
	
	@RequestMapping(value="/list")
	@ResponseBody
	public DemoForm list() {
		DemoForm a1 = new DemoForm() ;
		a1.setName("aaa");
		return a1 ;
	}
	
}
